package app.fugema.shop.main.order.vm;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import app.fugema.shop.main.order.model.GroupBookingBean;

import com.base.common.model.bean.BaseDataWrapper;
import com.base.common.netBeanPackage.BaseResponse;
import com.base.common.netBeanPackage.LiveDataWrapper;
import com.base.common.viewmodel.BaseViewModel;
import app.fugema.shop.http.HttpService;
import app.fugema.shop.main.order.model.GroupDetailResult;
import app.fugema.shop.main.order.model.GroupOrderResult;
import app.fugema.shop.main.order.model.OrderDetailResult;

import java.util.HashMap;
import java.util.Map;

public class GroupBookingVM extends BaseViewModel {
    public GroupBookingVM(@NonNull Application application) {
        super(application);
    }


    /**
     * 我的拼团订单
     */
    public MutableLiveData<LiveDataWrapper<GroupOrderResult>> getGroupOrders(int page, String userKey)
    {
        return send(HttpService.getHttpServer().getGroupOrder(page, userKey));
    }

    /**
     * 拼团订单详情
     * 接口地址
     */
    public MutableLiveData<LiveDataWrapper<GroupDetailResult>> groupOrderInfo(long groupOnId, String userKey)
    {
        return send(HttpService.getHttpServer().groupOrderDetail(groupOnId,userKey));
    }

    /**
     * 订单详情信息
     * @param orderId
     * @param userKey
     * @return
     */
    public MutableLiveData<LiveDataWrapper<OrderDetailResult>> getOrderDetail(long orderId, String userKey)
    {
        return send(HttpService.getHttpServer().getOrderDetail(orderId ,userKey));
    }


    public MutableLiveData<LiveDataWrapper<GroupBookingBean>> pageGroupOnProd(int pn) {
        return send(HttpService.getHttpServer().pageGroupOnProd(pn, 10));
    }

    /**
    public MutableLiveData<LiveDataWrapper<BaseResponse>> groupOneKeyJoin(int prodId, int shopId, int skuId)
    {
        Map<String, Object> map = new HashMap<>();
        map.put("prodId", prodId);
        map.put("shopId", shopId);
        map.put("skuId", skuId);
        return send(HttpService.getHttpServer().groupOneKeyJoin(map));
    }
    */
    /*
    public MutableLiveData<LiveDataWrapper<BaseResponse>> cancelGroup(int groupOnId)
    {
        return send(HttpService.getHttpServer().cancelGroup(groupOnId));
    }
    */
}
